home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / syswit / instruct.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  4.0 KB  |  146 lines

  1. VERSION 2.00
  2. Begin Form Instructions 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Instructions"
  5.    ClientHeight    =   4470
  6.    ClientLeft      =   1740
  7.    ClientTop       =   2235
  8.    ClientWidth     =   6495
  9.    Height          =   4875
  10.    Left            =   1680
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   4470
  16.    ScaleWidth      =   6495
  17.    Top             =   1890
  18.    Width           =   6615
  19.    Begin CommandButton ExitButton 
  20.       Cancel          =   -1  'True
  21.       Caption         =   "Close"
  22.       Default         =   -1  'True
  23.       Height          =   375
  24.       Left            =   5640
  25.       TabIndex        =   0
  26.       Top             =   240
  27.       Width           =   735
  28.    End
  29.    Begin TextBox List1 
  30.       BackColor       =   &H00C0C0C0&
  31.       BorderStyle     =   0  'None
  32.       Height          =   3975
  33.       Left            =   240
  34.       MultiLine       =   -1  'True
  35.       ScrollBars      =   2  'Vertical
  36.       TabIndex        =   1
  37.       TabStop         =   0   'False
  38.       Text            =   "Text1"
  39.       Top             =   240
  40.       Width           =   5295
  41.    End
  42. DefInt A-Z
  43. Sub ExitButton_Click ()
  44.   Close FileNUM%
  45.   Unload INSTRUCTIONS
  46. End Sub
  47. Function FileErrors (errVal As Integer) As Integer
  48.   msgType% = MB_ICONEXCLAMATION
  49.   Select Case errVal
  50.     Case ERR_DEVICEUNAVAILABLE
  51.       Msg$ = "That device appears unavailable."
  52.       msgType% = MB_ICONEXCLAMATION + 4
  53.     Case ERR_DISKNOTREADY
  54.       Msg$ = "Insert a disk in the drive and close the door."
  55.     Case ERR_DEVICEIO
  56.       Msg$ = "Internal disk error."
  57.       msgType% = MB_ICONEXCLAMATION + 4
  58.     Case ERR_DISKFULL
  59.       Msg$ = "Disk is full.  Continue?"
  60.       msgType% = 35
  61.     Case Err_BADFILENAME, ERR_BADFILENAMEORNUMBER
  62.       Msg$ = "That filename is illegal."
  63.     Case ERR_PATHDOESNOTEXIST
  64.       Msg$ = "That path doesn't exist."
  65.     Case ERR_BADFILEMODE
  66.       Msg$ = "Can't open your file for that type of access."
  67.     Case ERR_FILEALREADYOPEN
  68.       Msg$ = "This file is already open"
  69.     Case ERR_INPUTPASTENDOFFILE
  70.     Msg$ = "This file has a nonstandard end-of-file marker, "
  71.     Msg$ = Msg$ + "or an attempt was made to read beyond "
  72.     Msg$ = Msg$ + "the end-of-file marker."
  73.     Case Else
  74.       FileErrors = 3
  75.       Exit Function
  76.   End Select
  77.   response% = MsgBox(Msg$, msgType%, "Disk Error")
  78.   Select Case response%
  79.     Case 1, 4
  80.       FileErrors = 0
  81.     Case 5
  82.       FileErrors = 1
  83.     Case 2, 3
  84.       FileErrors = 2
  85.     Case Else
  86.       FileErrors = 3
  87.   End Select
  88. End Function
  89. Function Fileopener (NameToUse$, Mode%, RecordLen%) As Integer
  90.   Const READFILE = 2
  91.   FileNUM% = FreeFile
  92.   On Error GoTo OpenerError
  93.   Open NameToUse For Input As FileNUM%
  94.   Fileopener = FileNUM%
  95. Exit Function
  96. OpenerError:
  97.   Action% = FileErrors(Err)
  98.   Select Case Action%
  99.     Case 0
  100.       Resume
  101.     Case Else
  102.       Fileopener = 0
  103.       Exit Function
  104.     End Select
  105. End Function
  106. Sub Form_Load ()
  107.   Openfile
  108. End Sub
  109. Sub Form_Paint ()
  110. AUTOREDRAW = True
  111. Call Frame2(INSTRUCTIONS, 60, 60, INSTRUCTIONS.Height - 530, INSTRUCTIONS.Width - 254)
  112. Call Frame(INSTRUCTIONS, LIST1.Left - 5, LIST1.top - 5, LIST1.Height + 10, LIST1.Width + 10)
  113. End Sub
  114. Sub List1_GotFocus ()
  115. Exitbutton.SetFocus
  116. End Sub
  117. Sub Openfile ()
  118.    WorkingFileName = Windir + "\SYS2.TXT"
  119.     OpenMode% = READFILE
  120.     FileNUM% = Fileopener(WorkingFileName, OpenMode%, 0)
  121.       
  122.   On Error GoTo ReadError
  123.   If LOF(FileNUM%) > 60000 Then
  124.     Msg$ = "Sorry your file is too large to edit."
  125.     MsgBox Msg$, 16, "File Too Big"
  126.     Exit Sub
  127.   End If
  128.   Do Until EOF(FileNUM%)
  129.     Line Input #FileNUM%, NextLine$
  130.     LineFromFile$ = LineFromFile$ + NextLine$ + Chr$(13) + Chr$(10)
  131.   Loop
  132. LIST1.Text = LineFromFile$
  133.   Close FileNUM%
  134. Exit Sub
  135. ReadError:
  136.   Action% = FileErrors(Err)
  137.   Select Case Action%
  138.     Case 0
  139.       Resume
  140.     Case 1
  141.       Resume Next
  142.     Case 2
  143.       Exit Sub
  144.   End Select
  145. End Sub
  146.